<template>
	<div>
		<HyCard :title="title">
			<el-timeline style="max-width: 800px">
				<el-timeline-item
					:hollow="data.length - 1 === index ? true : false"
					v-for="(item, index) in data"
					:timestamp="item.name"
					placement="top"
					:key="index"
					type="primary"
					size="large"
				>
					<el-card>
						<div class="mb-1">操作人：{{ item.operationUser }}</div>
						<div class="mb-1">电话：{{ item.phone }}</div>
						<div class="mb-1">操作类型：{{ item.operationType }}</div>
						<div class="mb-1" v-if="item.operationType == '审批'||item.operationType == '意见回复人回复'">
							<div class="mb-1">
								审批结果：
								<el-tag v-if="item.approveStatus == 2">{{item.approveResult}}</el-tag>
								<el-tag type="danger" v-else>{{item.approveResult}}</el-tag>
							</div>
							<div v-if="item.fileUrlList" class="mb-1 flex">
								<span class="mb-t">附件:</span>
								<FilePreview :type="'view'" v-model="item.fileUrlList" />
							</div>
						</div>
						<div class="mb-1" v-if="item.operationType == '审批'||item.operationType == '意见回复人回复'">
							审批意见：{{ item.approveDesc }}
						</div>
						<div class="mb-1">操作时间：{{ item.operationTime }}</div>
					</el-card>
				</el-timeline-item>
			</el-timeline>
		</HyCard>
	</div>
</template>
<script setup lang="ts">
import HyCard from '/@/components/HyCard/index.vue';
import { runPathShow } from "/@/api/areaDigital";
import FilePreview from '/@/components/HyUploadCopy/index.vue';

// import { runPathShow } from '/@/api/flow/task/index.ts';
// 定义父组件传过来的值
const props = defineProps({
	flowData: {
		type: Object,
		default: () => {
			return {};
		},
	},
	processInstanceId: {
		type: String,
		default: () => {
			return '';
		},
	},
	title: {
		type: String,
		default: () => {
			return '留痕轨迹';
		}
	}
});
onMounted(() => {
	getPathData()
});

const getPathData = () => {
	runPathShow({ processInstanceId: props.processInstanceId }).then((res: any) => {
		data.value = res.data?.data;
	});
}

const data = ref([
	// {
	// 	deptName: null,
	// 	reason: '',
	// 	cz: '梁梦成',
	// 	name: '三清单审定',
	// 	nickname: '梁梦成',
	// 	mobile: '15223293770',
	// 	cztime: 1710750614000,
	// 	files: null,
	// 	state: '1004',
	// 	mark: '22222',
	// },
	// {
	// 	deptName: null,
	// 	reason: '',
	// 	cz: '张辉',
	// 	name: '三清单审定',
	// 	nickname: '张辉',
	// 	mobile: '13600000014',
	// 	cztime: 1710750588000,
	// 	files: null,
	// 	state: '1004',
	// 	mark: '222',
	// },
]);
defineExpose({ getPathData });
</script>
<style scoped lang="scss">
.mb-t{
	margin-right: 5px;
}
</style>
